//
//  NSDictionary+M1.m
//  NewMarryU
//
//  Created by apple on 2018/7/18.
//  Copyright © 2018年 Cedar. All rights reserved.
//

#import "NSDictionary+M1.h"

@implementation NSDictionary (M1)
-(NSString *)m1_stringKey:(NSString *)key{
    if (![self isKindOfClass:[NSDictionary class]]) {
        return @"";
    }
    if (!self||!key) {
        return @"";
    }
    if (!self[key]) {
        return @"";
    }
    id m1_objc = [self objectForKey:key];
    if ([m1_objc isKindOfClass:[NSString class]]) {
        return m1_objc;
    }
    if ([m1_objc isKindOfClass:[NSNumber class]]) {
        return [NSString stringWithFormat:@"%@",m1_objc];
    }
    return @"";
}
-(NSDictionary *)m1_dictionaryKey:(NSString *)key{
    if (!self||!key) {
        return @{};
    }
    if (!self[key]) {
        return @{};
    }
    id m1_objc = [self objectForKey:key];
    if ([m1_objc isKindOfClass:[NSDictionary class]]) {
        return m1_objc;
    }
    if ([m1_objc isKindOfClass:[NSArray class]]) {
        return m1_objc;
    }
    return @{};
}
@end
